<template>
  <div>
    <!-- 咨询结果 -->
    <detailBase :user="user" :result="result"></detailBase>
    <!-- 解决方案 -->
    <solution
      :hand-list="handList"
      :hand-list-simple="handListSimple"
      :say-list="sayList"
      :suit-list="suitList"
      :cannot-list="cannotList"
      :food-list="foodList"
      :food-book="foodBook"
      :progress="progress"
    ></solution>
    <!-- 门店推荐 -->
    <recomendDoctorRes
      :id="id"
      :commodity="commodity"
      :record_id="record_id"
    ></recomendDoctorRes>
  </div>
</template>
<script>
import detailBase from './detailBase';
import solution from './solution';
import recomendDoctorRes from './recomendDoctorRes';

export default {
  components: {
    detailBase,
    solution,
    recomendDoctorRes
  },
  props: {
    record_id: {},
    id: {}
  },
  data() {
    return {
      user: {},
      result: {},
      product: [],
      doctors: [],
      recommendProductId: [],
      progress: {
        book: [],
        medicine: [],
        nutrition: [],
        physical: [],
        stick: [],
        fit_tuina: '',
        bubble: []
      },
      handList: {list: []},
      handListSimple: {list: []},
      sayList: {},
      foodList: {},
      foodBook: [],
      commodity: [],
      suitList: [],
      cannotList: []
    };
  },
  watch: {
    record_id: {
      handler(v) {
        if (v) {
          this.getRecord();
          //   this.getDoctors();
        }
      },
      immediate: true
    }
  },
  methods: {
    getRecord() {
      this.$http
        .post(this.$url.getRecord, {
          u_id: this.id,
          record_id: this.record_id,
          is_medical: 2
        })
        .then(res => {
          this.user = res.user;
          this.result = res.result;
          this.progress = res.progress;
          this.handList = res.handList;
          this.handListSimple = res.handListSimple;
          this.sayList = res.sayList;
          this.foodList = res.foodList;
          this.foodBook = res.foodBook;
          this.commodity = res.commodity;
          this.suitList = res.suit;
          this.cannotList = res.cannot;
        })
        .catch(this.$catch);
    }
  }
};
</script>
